import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User: Administrator
 * Data: 2023 - 08 - 19
 * Time: 16:53
 */
class Solution {
    public List<String> buildArray(int[] target, int n) {
        List<String> list = new ArrayList<>();
        int i = 0;
        for(int j = 1; j <= n; j++) {
            if(i < target.length && j == target[i]) {
                list.add("Push");
                i++;
            }else if(i < target.length && j != target[i]) {
                list.add("Push");
                list.add("Pop");
            }
        }
        return list;
    }
}

